﻿@model Romantics.Models.HikeViewModel
@using Romantics
@{
    ViewBag.Title = Model.PhotoAlbum.Name;

    var Action = ((string)ViewContext.RouteData.Values["Action"]);
    var Controller = ((string)ViewContext.RouteData.Values["Controller"]);
}
@section RenderMeta{
    <meta name="description" content="@Model.Options.MetaDescription"/>
    <meta name="author" content="@Model.Options.Author"/>
    @{
        var meta = Model.PhotoAlbum.Meta ?? Model.Options.MetaKeywords;
        <meta name="keywords" content="@meta" />
    }
}
<div id="content">
    <div class="post">
        <div class="post-meta">
            <div class="row">
                <div class="post-title">
                    <h1>@Html.HikeLink(Model.PhotoAlbum.Hike)</h1>
                </div>
                <!-- AddThis -->
                <div class="share-links">
                    @Html.Partial("_AddThis", Model.PhotoAlbum)
                </div>
            </div>
            <div class="row">
                <div class="post-category">
                    <span>Катогория:&nbsp;</span>@Html.CategoryLink(Model.PhotoAlbum.Hike.Category, Controller)
                </div>
                <div class="post-category">
                    <span>Регион:&nbsp;</span>@Html.RegionLink(Model.PhotoAlbum.Hike.Region, Controller)
                </div>
            </div>
            <div class="row">
                <span>Маршрут:&nbsp;</span>@Html.Raw(Model.PhotoAlbum.Hike.Route)
            </div>
            <div class="mode">
                <span>Размер фотографий:&nbsp;</span>
                <span class="@(Model.Mode == "small" ? "active" : "")">@Html.ActionLink("Маленький", "PhotoAlbum", new { mode = "small", page = Model.CurrentPage }, new { title = "Маленький" })</span>
                <span class="@(Model.Mode == "medium" || Model.Mode == "" ? "active" : "")">@Html.ActionLink("Средний", "PhotoAlbum", new { mode = "medium", page = Model.CurrentPage }, new { title = "Средний" })</span>
                <span class="@(Model.Mode == "large" ? "active" : "")">@Html.ActionLink("Большой", "PhotoAlbum", new { mode = "large", page = Model.CurrentPage }, new { title = "Большой" })</span>
                <span class="@(Model.Mode == "xlarge" ? "active" : "")">@Html.ActionLink("Огромный", "PhotoAlbum", new { mode = "xlarge", page = Model.CurrentPage }, new { title = "Огромный" })</span>
                <span class="@(Model.Mode == "slideshow" ? "active" : "")">@Html.ActionLink("Слайд-шоу", "PhotoAlbum", new { mode = "slideshow", page = Model.CurrentPage }, new { title = "Слайд-шоу" })</span>
            </div>
            <div class="posted-date">
                @{
                    if (Model.PhotoAlbum.Hike.Duration > 1)
                    {
                    <span>С&nbsp;</span>@Model.PhotoAlbum.Hike.StartDate.ToString("d")<span>&nbsp;по&nbsp;</span>@Model.PhotoAlbum.Hike.EndDate.ToString("d")
                    }
                    else
                    {
                    @Model.PhotoAlbum.Hike.StartDate.ToString("d")
                    }
                }
            </div>
            <div class="row">
                <div class="post post-tags">
                    @Html.PageLinks(Model, x => Url.Action(Action, Controller, new { page = x }))
                </div>
            </div>
        </div>
        <div class="post-body">
            @{
                if(Model.PhotoAlbum.Items.Count > 0)
                {
                    foreach (var item in Model.PhotoAlbum.Items.OrderBy(i => i.ID).Skip((Model.CurrentPage - 1) * 20).Take(20))
                    {
                        var href = item.Href(Url);
                        <div class="post-album active">
                            <div class="@Model.Mode">
                                <a href="@href">
                                @{switch (Model.Mode.ToLower())
                                  {
                                      case "small":
                                    <img src="@item.Small" border="0" />
                                          break;
                                      case "large":
                                    <img src="@item.Large" border="0" />
                                          break;
                                      case "xlarge":
                                    <img src="@item.XLarge" border="0" />
                                          break;
                                      default:
                                    <img src="@item.Middle" border="0" />
                                          break;
                                  }
                                }
                                </a>
                            </div>
                        </div>
                    }
                }
                else
                {
                    <div class="post">
                    <div class="post-meta">
                        <div class="row">
                            <div class="post-title">
                                <h1>
                                    Нет фотографий - видно не обработали еще.<br/>
                                    Или добавить забыли....<br/>
                                    Наш Вам совет - зайдите чуть позже.
                                </h1>
                            </div>
                        </div>
                    </div>
                    </div>
                }
            }
        </div>
        <div class="row">
            <div class="post post-tags">
                @Html.PageLinks(Model, x => Url.Action(Action, Controller, new { page = x }))
            </div>
        </div>
        @Html.Partial("_DisqusComment", Model.PhotoAlbum)
    </div>
</div>

